from typing import Optional, List

from fastapi import Query
from pydantic import BaseModel


class QueryBase(BaseModel):
    skip: int = Query(1, ge=0)
    limit: int = Query(10, ge=0)


class EmployeeQuery(BaseModel):
    query_base: QueryBase
    phone: Optional[str] = None
    name: Optional[str] = None
    port: Optional[int] = 0


class StudentQuery(BaseModel):
    query_base: QueryBase
    name: Optional[str] = None
    class_id: Optional[int] = 0
    school_type: Optional[int] = 0
    has_graduation_cert: Optional[bool] = None
    status: Optional[int] = 0
    sale_id: Optional[int] = 0
    source: Optional[int] = 0
    pay_type: Optional[int] = 0


class SubjectSectionQuery(BaseModel):
    subject_id: Optional[int] = 0
    section_id: Optional[int] = 0


class ClassQuery(BaseModel):
    query_base: QueryBase
    class_type: Optional[int] = 0
    course_id: Optional[int] = 0
    status: Optional[int] = 0


class ClassByStatusListQuery(BaseModel):
    status_list: List[int]


class ClassByStatusAndPageQuery(BaseModel):
    query_base: QueryBase
    status_list: List[int]


class AttendanceQuery(BaseModel):
    query_base: QueryBase
    attend_date: Optional[str] = None
    student_id: Optional[int] = 0
    is_normal: Optional[bool] = None
    abnormal_type: Optional[int] = 0


class AttendanceDateIntervalQuery(BaseModel):
    query_base: QueryBase
    attend_date_begin: Optional[str] = None
    attend_date_end: Optional[str] = None
    student_id: int
    is_normal: Optional[bool] = None
    abnormal_type: Optional[int] = 0


class NoticeQuery(BaseModel):
    query_base: QueryBase
    user_id: Optional[int] = 0


class InterviewQuery(BaseModel):
    query_base: QueryBase
    student_id: Optional[int] = 0
